/*
 * Network.h
 *
 *  Created on: Mar 8, 2011
 *      Author: Alan Mattila
 */

#ifndef NETWORK_H_
#define NETWORK_H_

#define NETWORK_NO_ERROR 0
#define NETWORK_ERROR 1

#include <QtCore>
#include <QtNetwork>
#include <QObject>

#include <string>

#include "Packet.h"

#define DEFAULT_PORT 13666

using std::string;

class Network : public QObject
{
	Q_OBJECT

public:
	// Constructor/destructor functions
	Network();
	Network(string _hostname);
	Network(unsigned _port);
	Network(string _hostname, unsigned _port);
	~Network();

	// Mutator functions
	void SetPort(unsigned _port) { port = _port; }
	void SetHostname(string _hostname) { hostname = _hostname; }

signals:
	void packetReceived(packetType_t);

protected:
	Packet *packet;
	string hostname;
	unsigned port;
};

#endif /* NETWORK_H_ */
